﻿<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="$rootnamespace$.$safeitemname$"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:$rootnamespace$"
    xmlns:common="using:$safeprojectname$.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:ExtensionType="ShareTarget"
    d:DataContext="{Binding Source={d:DesignInstance Type=local:$fileinputname$DesignData, IsDesignTimeCreatable=True}}">

    <Page.Resources>
        <common:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
        <common:BooleanNegationConverter x:Key="BooleanNegationConverter"/>
    </Page.Resources>

    <!--
        This grid acts as a root panel for the page that defines three rows:
        * Row 0 contains the standard share target header
        * Row 1 contains a TextBox for adding a Comment
        * Row 2 contains the standard share target footer
    -->
    <Grid Style="{StaticResource LayoutRootStyle}">
        <Grid Margin="40,20,40,60">
            <Grid.RowDefinitions>
                <RowDefinition Height="180"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <!-- The standard share target header displays metadata about the shared item -->
            <Image
                Source="{Binding Image}"
                Stretch="Uniform"
                Visibility="{Binding ShowImage, Converter={StaticResource BooleanToVisibilityConverter}}"
                VerticalAlignment="Top"				
                MinWidth="80"
                MinHeight="80"
                MaxWidth="240"
                MaxHeight="160"
                Margin="0,0,20,0"/>
            <StackPanel Grid.Column="1">
                <TextBlock
                    Text="{Binding Title}"
                    Margin="0,-10,0,20"
                    TextWrapping="NoWrap"
                    Foreground="{StaticResource ApplicationSecondaryForegroundThemeBrush}"
                    Style="{StaticResource SubheaderTextStyle}"/>
                <TextBlock
                    Text="{Binding Description}"
                    MaxHeight="60"
                    Foreground="{StaticResource ApplicationSecondaryForegroundThemeBrush}"
                    Style="{StaticResource BodyTextStyle}"/>
            </StackPanel>

            <Grid Grid.Row="1" Grid.ColumnSpan="2">
                <!-- TODO: Add application scenario-specific sharing UI -->
            </Grid>

            <TextBox
                Grid.Row="1"
                Grid.ColumnSpan="2"
                Margin="0,0,0,27"
                Text="{Binding Comment}"
                Visibility="{Binding SupportsComment, Converter={StaticResource BooleanToVisibilityConverter}}"
                IsEnabled="{Binding Sharing, Converter={StaticResource BooleanNegationConverter}}"/>
            
            <!-- Standard share target footer -->
            <Grid Grid.Row="2" Grid.ColumnSpan="2">
                <ProgressRing
                    IsActive="{Binding Sharing}"
                    MinWidth="20"
                    MinHeight="20"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Top"
                    Margin="0,5,0,0"/>
                <TextBlock
                    Text="Sharing&#x2026;"
                    Visibility="{Binding Sharing, Converter={StaticResource BooleanToVisibilityConverter}}"
                    HorizontalAlignment="Left"
                    Margin="25,0,0,0"
                    Style="{StaticResource ItemTextStyle}"/>
                <Button
                    AutomationProperties.AutomationId="ShareButton"
                    AutomationProperties.Name="Share"
                    TabIndex="1"
                    Content="Share"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Top"
                    Margin="0,-5,-3,0"
                    Command="{Binding ShareCommand}"/>
            </Grid>
        </Grid>
    </Grid>
</common:LayoutAwarePage>
